# _*_ coding: utf-8 _*_
# @Time : 2024-01-25 17:04
# @Author : WF

"""
pyautogu上篇文章已经详细说明了，但是由于输入格式问题，只能输入英文，
所以pyperclip 将文本内容复制到粘贴板，然后用pyautogu进行键盘粘贴操作

pip install pyperclip


NotImplementedError: The confidence keyword argument is only available if OpenCV is installed.
pip install opencv_python
"""
import base64

import pyautogui
import pyperclip

# 每次延迟 1s
pyautogui.PAUSE = 1

pyautogui.FAILSAFE = True

pyautogui.hotkey('win', 'm')
pyautogui.hotkey('win', 'e')

# 放大
location = pyautogui.locateOnScreen('step3.png', confidence=0.7)
pyautogui.doubleClick(location)
pyautogui.moveTo(1400, 170)
# 单击鼠标
pyautogui.click()
pyperclip.copy(r"E:\工作资料\2024年度\image")
pyautogui.press('enter')

# 移动鼠标
pyautogui.moveTo(pyautogui.size()[0] / 2, pyautogui.size()[1] / 2)
# 单击鼠标
pyautogui.click()
pyautogui.hotkey('ctrl', 'a')


# --------微信
# 返回主界面
wechat_id = "测试自动发"
pyautogui.hotkey('win', 'm')

# 获取 微信位置，并双击
# location = pyautogui.locateOnScreen('微信.png', confidence=0.7)
location = pyautogui.locateOnScreen('step1.png', confidence=0.7)
print(location)
pyautogui.doubleClick(location)

# 搜索图标
# location = pyautogui.locateOnScreen('微信搜索.png', confidence=0.7)
# location = pyautogui.locateOnScreen('step2.png', confidence=0.7)
# print(location)
# pyautogui.doubleClick(location)
# pyautogui.typewrite(wechat_id)
#
# pyautogui.moveTo(1000, 1120)
# # 单击鼠标
# pyautogui.click()
#
# pyautogui.hotkey('ctrl', 'v')
# pyautogui.press('enter')


